//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_dirtoobj.sqf"
#include "x_setup.sqf"

// direction from one object to another
// parameters: object1, object2
// example: _dir = [tank1, apc1] call FUNC(DirToObj);
private ["_o1","_o2","_deg","_pos1","_pos2"];
PARAMS_2(_o1,_o2);
_pos1 = getPosASL _o1;
_pos2 = getPosASL _o2;
_deg = ((_pos2 select 0) - (_pos1 select 0)) atan2 ((_pos2 select 1) - (_pos1 select 1));
if (_deg < 0) then {_deg = _deg + 360};
_deg